const fields = [
  {
    dataIndex: 'title',
    key: 'title',
    title: '公司信息',
    width: 600,
    scopedSlots: {
      customRender: 'CompanyInfo'
    }
  },
  {
    dataIndex: 'userTypeStr',
    key: 'userType',
    width: 100,
    title: '用户等级'
  },
  {
    title: '操作',
    key: 'action',
    fixed: 'right',
    scopedSlots: {
      customRender: 'action'
    }
  }
]

const formRow = [
  {
    span: 7,
    label: '注册时间',
    component: 'ASelect',
    placeholder: '请选择注册时间',
    prop: 'searchValue',
    loading: false,
    disabled: false,
    isCustomList: true,
    customRequestList(instance) {
      instance.loading = true
      instance.disabled = true
      setTimeout(() => {
        instance.disabled = false
        instance.loading = false
        instance.list = [
          { label: '全部时间', value: '0' },
          { label: '近一个月', value: '1' },
          { label: '近三个月', value: '2' },
          { label: '近半年', value: '3' },
          { label: '近一年', value: '4' },
        ]
      }, 1000)
    },
    allowClear: true
  },
  {
    span: 7,
    label: '账号级别',
    component: 'ASelect',
    placeholder: '请选择账号级别',
    prop: 'userType',
    loading: false,
    disabled: false,
    isCustomList: true,
    customRequestList(instance) {
      instance.loading = true
      instance.disabled = true
      setTimeout(() => {
        instance.disabled = false
        instance.loading = false
        instance.list = [
          { label: '系统用户', value: '00' },
          { label: '个人用户', value: '01' },
          { label: '企业用户', value: '02' },
        ]
      }, 1000)
    },
    allowClear: true
  },
  {
    span: 7,
    label: '用户名',
    component: 'AInput',
    placeholder: '请输入用户名',
    prop: 'userName',
    allowClear: true
  }
]

const slotOpt = [
  {
    slot: 'CompanyInfo',
    component: 'CompanyInfo',
    cb: 'toDetail'
  },
  {
    slot: 'action',
    component: 'Action',
    list: [
      { name: '修改', cb: 'edit' },
      { name: '删除', cb: 'singleDelete', divider: true }
    ]
  }
]

module.exports = {
  fields,
  formRow,
  slotOpt
}
